import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
import { useEffect, useState } from 'react';
export default function useNow(options) {
  var _ref = options !== null && options !== void 0 ? options : {},
    _ref$ms = _ref.ms,
    ms = _ref$ms === void 0 ? 1000 : _ref$ms;
  var _useState = useState(Date.now()),
    _useState2 = _slicedToArray(_useState, 2),
    now = _useState2[0],
    setNow = _useState2[1];
  useEffect(function () {
    var interval = setInterval(function () {
      console.log(111);
      setNow(Date.now());
    }, ms);
    return function () {
      return clearInterval(interval);
    };
  }, []);
  console.log(now);
  return {
    now: now
  };
}